package com.example.exampleproject.controller;

import com.example.exampleproject.entity.EmploymentIndustryEntity2;
import com.example.exampleproject.service.EmploymentIndustryService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class EmploymentIndustryController2 {

    @Autowired
    EmploymentIndustryService2 employmentIndustryService;

    @RequestMapping("/employmentIndustryByYear/{year}")
    public List<EmploymentIndustryEntity2> getEmploymentIndustryByYear(@PathVariable("year") Integer year){
        return employmentIndustryService.getEmploymentIndustryByYear(year);
    }

    @PostMapping("/employmentIndustryByYear")
    public List<EmploymentIndustryEntity2> getEmploymentIndustryByYear(@RequestBody Map<String,Object> prams){
        Integer year = (Integer) prams.get("year");
        return employmentIndustryService.getEmploymentIndustryByYear(year);
    }
}
